package com.kacheap.handler;

import java.util.concurrent.TimeUnit;

import com.kacheap.model.MessageModel;
import com.lmax.disruptor.EventHandler;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HelloEventHandler implements EventHandler<MessageModel> {

	@Override
	public void onEvent(MessageModel event, long sequence, boolean endOfBatch) {
		try {
			if (null == event) {
				return;
			}
			
			TimeUnit.SECONDS.sleep(1);
			// TODO 这里添加业务功能代码
			log.info(Thread.currentThread().getId() + " ==> 消费者消费的信息是：{}", event);
		} catch (Exception e) {
			log.info("消费者处理消息失败");
		}

	}

}